package com.xwd.web.student;


import com.xwd.domain.Grade;
import com.xwd.service.GradeService;
import com.xwd.service.impl.GradeServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/getClassTotal")
public class GetClassServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //调用service方法，得到班级列表
        GradeService service = new GradeServiceImpl();
        List<Grade> classList = service.getClassTotalName();
        //存储数据返回集合
        req.setAttribute("classList",classList);
        req.getRequestDispatcher("/Educational/student/add.jsp").forward(req,resp);
    }
}
